/**
 * Copyright: Copyright (c) 2018, 2022
 * Company: 杭州叙简科技股份有限公司
 */
package cn.com.scooper.service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 通用业务处理类综合管理
 * @author LuLihong
 * @date 2018年4月3日
 */
@Component
public final class Managers implements BaseManager {
	private static final Logger log = LoggerFactory.getLogger(Managers.class);
	
	/** 业务定义 */
	
	/**
	 * 启动
	 */
	@Override
	@PostConstruct
	public void startup() {
		BaseManager[] items = new BaseManager[] {};
		for (BaseManager item : items) {
			if (item == null) continue;
			try {
				item.startup();
				log.info("starup success: "+item.getClass().getCanonicalName());
			} catch (Throwable e) {
				log.error("startup failed : " + item.getClass().getCanonicalName());
			}
		}
	}
	
	/**
	 * 关闭
	 */
	@Override
	@PreDestroy
	public void shutdown() {
		BaseManager[] items = new BaseManager[] {};
		for (BaseManager item : items) {
			if (item == null) continue;
			try {
				item.shutdown();
			} catch (Throwable e) {
				log.error("shutdown failed : " + item.getClass().getCanonicalName());
			}
		}
	}
}
